export { shuffle, debounce, isEmpty, random, isEqual, isMatch } from 'lodash';

/* 封装歌曲当前播放时间 */
export function format(interval) {
  interval = interval | 0;
  var min = (interval / 60) | 0;
  var sec = interval % 60;
  if (sec.toString().length === 1) {
    sec = `0${sec}`;
  }
  return `${min}:${sec}`;
}

export function transferTime(interval) {
  const m = Math.floor(interval / 60);
  const s = interval - m * 60;
  const dt = `${m * 60 + s}.000`;
  return parseFloat(dt) * 1000;
}

export function getPlayCount(num) {
  if (num < 9999) {
    return num;
  }
  const count = Math.floor(num / 10000);
  if (count <= 9999) {
    return `${count}万`;
  }
  if (count <= 99999) {
    return `${count / 10000}亿`;
  }
  return `∞`;
}
